package com.gosophia.conference.action.common;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.security.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;

import com.gosophia.commons.web.action.BaseAjaxAction;
import com.gosophia.conferenceManagement.scheme.dto.SchemeTransientStoreDTO;
import com.gosophia.conferenceManagement.scheme.ws.ConferenceSchemeWebService;
import com.gosophia.springsecurity.UserDetailsImpl;


@Scope("prototype")
@Controller("GetConferenceStartListAction")
public class GetConferenceStartListAction extends BaseAjaxAction<SchemeTransientStoreDTO>{

    private static final long serialVersionUID = 1L;
    @Autowired
    private ConferenceSchemeWebService conferenceSchemeWebService;
    @Override
    public String _execute() throws Exception {
        
        UserDetailsImpl userDetails = (UserDetailsImpl) SecurityContextHolder
        .getContext().getAuthentication().getPrincipal();
        
        Long userInfoId = userDetails.getUserAccountDTO().getUserInfoDTO().getUserInfoId();
        
        if(this.searchType==true){
            page = conferenceSchemeWebService.findSchemeTransientStoreByPage(userInfoId, page.getPageSize(), page.getPageNo(), propertyFilters, orderConditions);
        }else{
            page = conferenceSchemeWebService.findTransientStoreBySearchNameAndPage(userInfoId, page.getPageSize(), new String(searchString.getBytes("iso-8859-1"), "utf-8"), page.getPageNo(), propertyFilters, orderConditions);
        }
        
        if(page.getResult().size()==0){
            super.getRequestResult().setRsltCode("1");
        }else{
            super.getRequestResult().setRsltCode("0");
        }
        return SUCCESS;
    }
    @Override
    public SchemeTransientStoreDTO getDetailData() {
        return null;
    }
   

    

}
